@echo off
echo === VC++2005 Direct Build ===

REM 设置VC++2005环境
call "C:\Program Files (x86)\Microsoft Visual Studio 8\VC\vcvarsall.bat" x86

cd /d D:\vc\devops-platform

echo Cleaning previous build...
if exist build-vc2005 rmdir /s /q build-vc2005
mkdir build-vc2005

echo Compiling source files...

REM 编译主程序
cl.exe /nologo /MT /O2 /DNDEBUG /D_WIN32_WINNT=0x0501 ^
/Isrc ^
/Fobuild-vc2005/main.obj ^
/c src/main.cpp

if %errorlevel% neq 0 (
    echo [ERROR] Compilation failed!
    exit /b 1
)

echo Linking executable...
link.exe /nologo /OUT:build-vc2005\devops-platform.exe ^
build-vc2005\main.obj ^
kernel32.lib user32.lib advapi32.lib

if %errorlevel% equ 0 (
    echo [SUCCESS] VC++2005 Build completed!
    echo Executable: build-vc2005\devops-platform.exe
    build-vc2005\devops-platform.exe status
) else (
    echo [ERROR] Linking failed!
    exit /b 1
)
